package com.zqcy.workbench.wxapi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.onemdos.share.OneMDOSShareAPI;
import com.onemdos.share.OneMDOSSharePlatformConfig;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;

import androidx.annotation.Nullable;

public class WXEntryActivity extends Activity implements IWXAPIEventHandler {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        Log.e("WX","WXEntryActivity onCreate=====");
        super.onCreate(savedInstanceState);
        OneMDOSSharePlatformConfig.setWeiXIn("wxbdb0cec71f5d97ad");
        OneMDOSShareAPI.api.handleIntent(getIntent(), this);

    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
    }

    @Override
    public void onReq(BaseReq req) {
        Log.e("WX","WXEntryActivity onReq=="+req.getType());
        switch (req.getType()) {
            case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
            case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
            default:
                break;
        }
        finish();
    }

    @Override
    public void onResp(BaseResp resp) {
        Log.e("WX","WXEntryActivity onResp====="+resp.errCode);
        switch (resp.errCode) {
            case BaseResp.ErrCode.ERR_OK:
                //发送成功
                break;
            case BaseResp.ErrCode.ERR_USER_CANCEL:
                //发送取消
                break;
            case BaseResp.ErrCode.ERR_AUTH_DENIED:
                //发送被拒绝
                break;
            case BaseResp.ErrCode.ERR_UNSUPPORT:
                //不支持错误
                break;
            default:
                //发送返回
                break;
        }
        finish();
    }
}
